﻿@page "/api/{TypeName}"
@using MudBlazor.Docs.Components
@namespace MudBlazor.Docs.Pages.Api

<style>
    .mud-table-toolbar { height: auto; }
    [id] { scroll-margin-top: 65px; }
</style>

<DocsPage>
    @if (DocumentedType != null)
    {
        <ApiBreadcrumbs Type="@DocumentedType" />

        <DocsPageHeader Title="@Title" IsApi="true" Component="@TypeName" />
        <DocsPageContent>

            @if (ShowInheritance)
            {
                <DocsPageSection>
                    <SectionHeader Title="Inheritance" />
                    <SectionContent Outlined="true" IsApiSection="true">
                        <MudGrid Class="pa-0">
                            <MudItem xs="12">
                                <ApiTypeHierarchy Type="@DocumentedType" />
                            </MudItem>
                        </MudGrid>
                    </SectionContent>
                </DocsPageSection>
            }

            @if (DocumentedType.Properties.Count > 0)
            {
                <DocsPageSection>
                    <SectionHeader Title="Properties" />
                    <SectionContent Outlined="true" IsApiSection="true">
                        <MudGrid Class="pa-0">
                            <MudItem xs="12">
                                <ApiMemberTable Mode="@ApiMemberTableMode.Properties" Type="@DocumentedType" />
                            </MudItem>
                        </MudGrid>
                    </SectionContent>
                </DocsPageSection>
            }

            @if (DocumentedType.Methods.Count > 0)
            {
                <DocsPageSection>
                    <SectionHeader Title="Methods" />
                    <SectionContent Outlined="true" IsApiSection="true">
                        <MudGrid Class="pa-0">
                            <MudItem xs="12">
                                <ApiMemberTable Mode="@ApiMemberTableMode.Methods" Type="@DocumentedType" />
                            </MudItem>
                        </MudGrid>
                    </SectionContent>
                </DocsPageSection>
            }

            @if (DocumentedType.Fields.Count > 0)
            {
                <DocsPageSection>
                    <SectionHeader Title="Fields" />
                    <SectionContent Outlined="true" IsApiSection="true">
                        <MudGrid Class="pa-0">
                            <MudItem xs="12">
                                <ApiMemberTable Mode="@ApiMemberTableMode.Fields" Type="@DocumentedType" />
                            </MudItem>
                        </MudGrid>
                    </SectionContent>
                </DocsPageSection>
            }

            @if (DocumentedType.Events.Count > 0)
            {
                <DocsPageSection>
                    <SectionHeader Title="Events" />
                    <SectionContent Outlined="true" IsApiSection="true">
                        <MudGrid Class="pa-0">
                            <MudItem xs="12">
                                <ApiMemberTable Mode="@ApiMemberTableMode.Events" Type="@DocumentedType" />
                            </MudItem>
                        </MudGrid>
                    </SectionContent>
                </DocsPageSection>
            }

            @if (DocumentedType.Children.Count > 0)
            {
                <DocsPageSection>
                    <SectionHeader Title="Derived Classes" />
                    <SectionContent Outlined="true" IsApiSection="true">
                        <MudGrid Class="pa-0">
                            <MudItem xs="12">
                                <ApiTypeTable BaseType="@DocumentedType" />
                            </MudItem>
                        </MudGrid>
                    </SectionContent>
                </DocsPageSection>
            }

            @if (DocumentedType.GlobalSettings.Count > 0)
            {
                <DocsPageSection>
                    <SectionHeader Title="Global Settings" />
                    <SectionContent Outlined="true" IsApiSection="true">
                        <MudGrid Class="pa-0">
                            <MudItem xs="12">
                                <ApiMemberTable Mode="ApiMemberTableMode.Globals" Type="@DocumentedType" />
                            </MudItem>
                        </MudGrid>
                    </SectionContent>
                </DocsPageSection>
            }          
        </DocsPageContent>
    }
    else
    {
        <DocsPageHeader Title="@(TypeName + " Not Found")" />
        <DocsPageContent>
            <MudGrid>
                <MudItem xs="12">
                    <MudAlert Severity="Severity.Warning">Sorry, the type @TypeName was not found.</MudAlert>
                </MudItem>
            </MudGrid>
        </DocsPageContent>
    }
</DocsPage>
